<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

	<title>个人资料</title>

	<link href="../AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
	<link href="../AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

	<link href="../css/personal.css" rel="stylesheet" type="text/css">
	<link href="../css/infstyle.css" rel="stylesheet" type="text/css">
	<script src="../AmazeUI-2.4.2/assets/js/jquery.min.js" type="text/javascript"></script>
	<script src="../AmazeUI-2.4.2/assets/js/amazeui.js" type="text/javascript"></script>
	<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.6/vue.min.js"></script>
	<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.19.2/axios.min.js"></script>
	<script src="../js/axiosUtil.js"></script>
</head>

<body>
	<!--头 -->
	<header>
		<article>
			<div class="mt-logo" id="app1">
				<!--顶部导航条 -->
				<div class="am-container header">
					<ul class="message-l">
						<div class="topMessage">
							<template v-if="!islogin">
								<div class="menu-hd">
									<a href="login.html" target="_top" class="h">亲，请登录</a>
									<a href="register.html" target="_top">免费注册</a>
								</div>
							</template>
							<template v-else>
								<div class="menu-hd">
									<a href="#" style="color: red;">{{username}}</a>
									<a href="#" @click="logout">退出登录</a>
								</div>
							</template>
						</div>
					</ul>
					<ul class="message-r" v-if="islogin">
						<div class="topMessage home">
							<div class="menu-hd"><a href="home.html" target="_top" class="h">商城首页</a></div>
						</div>
						<template v-if="islogin">
							<div class="topMessage my-shangcheng">
								<div class="menu-hd MyShangcheng"><a href="information.html" target="_top"><i
											class="am-icon-user am-icon-fw"></i>个人中心</a></div>
							</div>
							<div class="topMessage mini-cart">
								<div class="menu-hd"><a id="mc-menu-hd" href="shopcart.html" target="_top"><i
											class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong
											id="J_MiniCartNum" class="h">0</strong></a></div>
							</div>
						</template>
					</ul>
				</div>
		

				<!--悬浮搜索框-->

				<div class="nav white">
					<div class="logoBig">
						<li><img src="../images/logobig.png" /></li>
					</div>

					<div class="search-bar pr">
						<a name="index_none_header_sysc" href="#"></a>
						<form>
							<input id="searchInput" name="index_none_header_sysc" type="text" placeholder="搜索"
								autocomplete="off">
							<input id="ai-topsearch" class="submit am-btn" value="搜索" index="1" type="submit">
						</form>
					</div>
				</div>

				<div class="clear"></div>
			</div>
		</article>
	</header>

	<!--导航栏 -->
	<div class="nav-table">
		<div class="long-title"><span class="all-goods">全部分类</span></div>
		<div class="nav-cont">
			<ul>
				<li class="index"><a href="#">首页</a></li>
				<li class="qc"><a href="#">闪购</a></li>
				<li class="qc"><a href="#">限时抢</a></li>
				<li class="qc"><a href="#">团购</a></li>
				<li class="qc last"><a href="#">大包装</a></li>
			</ul>
		</div>
	</div>
	<b class="line"></b>
	<div class="center" >
		<div class="col-main">
			<div class="main-wrap" id="app2">

				<div class="user-info">
					<!--标题 -->
					<div class="am-cf am-padding">
						<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">个人资料</strong> /
							<small>Personal&nbsp;information</small></div>
					</div>
					<hr />

					<!--头像 -->
					<div class="user-infoPic">

						<div class="filePic">
							<input type="file" class="inputPic" allowexts="gif,jpeg,jpg,png,bmp" accept="image/*">
							<img class="am-circle am-img-thumbnail" src="../images/getAvatar.do.jpg" alt="" />
						</div>

						<p class="am-form-help">头像</p>

						<div class="info-m">
							<div><b>用户名：<i>{{user.username}}</i></b></div>
							<div class="u-level">
								<span class="rank r2">
									<s class="vip1"></s><a class="classes" href="#">铜牌会员</a>
								</span>
							</div>
							<div class="u-safety">
								<a href="safety.html">
									账户安全
									<span class="u-profile"><i class="bc_ee0000" style="width: 60px;"
											width="0">60分</i></span>
								</a>
							</div>
						</div>
					</div>

					<!--个人信息 -->
					<div class="info-main">
						<form class="am-form am-form-horizontal">

							<div class="am-form-group">
								<label for="user-name2" class="am-form-label">昵称</label>
								<div class="am-form-content">
									<input type="text" id="user-name2"  :value="user.username" readonly>
								</div>
							</div>

							<div class="am-form-group">
								<label for="user-phone" class="am-form-label">电话</label>
								<div class="am-form-content">
									<input id="user-phone" v-model="user.phone" type="tel">

								</div>
							</div>
							<div class="am-form-group">
								<label for="user-email" class="am-form-label">电子邮件</label>
								<div class="am-form-content">
									<input id="user-email" v-model="user.email" type="email">

								</div>
							</div>

							<div class="info-btn">
								<div class="am-btn am-btn-danger" @click="update">保存修改</div>
							</div>

						</form>
					</div>

				</div>

			</div>
			<!--底部-->

			<div class="footer">
				<div class="footer-hd ">
					<p>
						<a href="# ">燕园科技</a>
						<b>|</b>
						<a href="home.html">商城首页</a>
						<b>|</b>
						<a href="# ">支付宝</a>
						<b>|</b>
						<a href="# ">物流</a>
					</p>
				</div>
				<div class="footer-bd ">
					<p>
						<a href="#">关于燕园</a>
						<a href="# ">合作伙伴</a>
						<a href="# ">联系我们</a>
						<a href="# ">网站地图</a>
					</p>
				</div>
			</div>

		</div>

		<!-- 左侧菜单栏 -->
		<aside class="menu">
			<ul>
				<li class="person">
					<a href="#">个人中心</a>
				</li>
				<li class="person">
					<a href="#">个人资料</a>
					<ul>
						<li class="active"> <a href="information.html">个人信息</a></li>
						<li> <a href="address.html">收货地址</a></li>
						<li> <a href="password.html">修改密码</a></li>
					</ul>
				</li>
				<li class="person">
					<a href="#">我的交易</a>
					<ul>
						<!-- <li><a href="order.html">订单管理</a></li> -->
						<li> <a href="billlist.html">账单明细</a></li>
					</ul>
				</li>

			</ul>
		</aside>
	</div>	
	<script src="../js/public.js"></script>
	<script>
		let vm2 = new Vue({
			el: '#app2',
			data: {
				user: {

				}
			},
			created() {
				let token = window.localStorage.getItem('token')
				if (token) {
					$axios.get('/user/info',
						response => {
							this.user = response.data
						}
					)
				} else {
					alert("登录信息已过期，或者未登录，请重新登录")
					window.location.href="login.html"
				}
			},
			methods: {
				update() {
					$axios.put('/user/update',response => {window.alert("修改信息成功")},this.user)
				}
			}
		})
	</script>
</body>

</html>